#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;

#define INF 0x3F3F3F3F

int N, T, M1, M2;
int TN[52], DM[52], CM[52];
bool hasTrain[205][52][2];

int D[205][52];

int kase;

void readData() {
	cin >> T;
	for (int i=1; i<=N-1; i++)
		cin >> TN[i];
	cin >> M1;
	for (int i=1; i<=M1; i++) {
		cin >> DM[i];
		int sumT=0;
		for (int j=1; j<=N-1; j++) {
			hasTrain[DM[i]+sumT][j][0] = true;
			sumT+=TN[j];
			if (DM[i]+sumT>T) break;
		}
	}
	cin >> M2;
	for (int i=1; i<=M2; i++) {
		cin >> CM[i];
		int sumT=0;
		for (int j=N; j>=2; j--) {
			hasTrain[CM[i]+sumT][j][1] = true;
			sumT+=TN[j-1];
			if (CM[i]+sumT>T) break;
		}
	}
		
}

void DP() {
	//for (int i=1; i<=N-1; i++) D[T][i]=INF;
	
	D[T][N]=0;
	for (int i=T-1; i>=0; i--) {
		for (int j=1; j<=N; j++) {
			D[i][j] = D[i+1][j] + 1;
			if (j<N && hasTrain[i][j][0] && i+TN[j]<=T) {
				D[i][j] = min(D[i][j], D[i+TN[j]][j+1]);
			}
			if (j>1 && hasTrain[i][j][1] && i+TN[j-1]<=T) {
				D[i][j] = min(D[i][j], D[i+TN[j-1]][j-1]);
			}
		}
	}
}

void printAns() {
	cout << "Case Number " << ++kase << ": ";
	if (D[0][1]>=INF) cout << "impossible" << endl;
	else cout << D[0][1] << endl;
}


int main() {
	kase=0;
	while (true) {
		cin >> N;
		if (!N) break;
		memset(hasTrain, 0, sizeof(hasTrain));
		readData();
		memset(D, 0x3F, sizeof(D));
		DP();
		printAns();
	}
	
}
